<?php
namespace app\api\exception;

use think\Exception;

class ParamException extends Exception
{
    
    public $msg = [
        '200' => '请求成功',
        '201' => '创建成功',
        '400' => '参数错误',
        '401' => '没有权限访问',
        '403' => '服务器拒绝请求',
        '404' => '请求数据为空',
        '408' => '请求超时',
        '500' => '服务器内部错误',
        '502' => '微信内部错误'
    ];

    public function __construct($code,$msg = '')
    {
        $this->code = $code;
        $this->message = $msg;
    }

    public function getMsg()
    {
        return $this->msg[$this->code] ?? '超出范围';
    }
}